url = require 'url'
_ = require 'underscore'

config = require './config'

# url映射
restUrls =

  # 产品详细
  mainUrl : 'rest/prod/detail/'

restUrlBase = "http://#{config.getRestHost()}/"

# 遍历restUrls对象
_.each restUrls, (restUrl, key) ->
  # 每一个url都要加上协议：主机头 + 端口 + rest地址
  restUrls[key] = url.resolve restUrlBase, '' + restUrl

# 向外暴露对象/方法
module.exports = restUrls